broadway: Fix coordinates when drag move/resizeing
authorAlexander Larsson <alexl@redhat.com>
Thu, 28 Mar 2019 08:36:30 +0000 (09:36 +0100)
committerAlexander Larsson <alexl@redhat.com>
Fri, 29 Mar 2019 13:30:13 +0000 (14:30 +0100)
The x/y passed in are in the surface, not root coords.

gdk/broadway/gdksurface-broadway.c

index bc2ca62eed8b3b6902eed4d4528fcf3158597f9c..f5a11a3167e4a25b35d51d3bb986bd175f8c6b09 100644 (file)
@@ -1208,8 +1208,8 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface     *surface,
                                         GdkSurfaceEdge  edge,
                                         GdkDevice     *device,
                                         gint           button,
-                                        gint           root_x,
-                                        gint           root_y,
+                                        gint           x,
+                                        gint           y,
                                         guint32        timestamp)
 {
   MoveResizeData *mv_resize;
@@ -1232,8 +1232,8 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface     *surface,
   mv_resize->is_resize = TRUE;
   mv_resize->moveresize_button = button;
   mv_resize->resize_edge = edge;
-  mv_resize->moveresize_x = root_x;
-  mv_resize->moveresize_y = root_y;
+  mv_resize->moveresize_x = x  + impl->wrapper->x;
+  mv_resize->moveresize_y = y + impl->wrapper->y;
   mv_resize->moveresize_surface = g_object_ref (surface);
 
   mv_resize->moveresize_orig_width = gdk_surface_get_width (surface);
@@ -1251,8 +1251,8 @@ static void
 gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
                                       GdkDevice *device,
                                       gint       button,
-                                      gint       root_x,
-                                      gint       root_y,
+                                      gint       x,
+                                      gint       y,
                                       guint32    timestamp)
 {
   MoveResizeData *mv_resize;
@@ -1274,8 +1274,8 @@ gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
 
   mv_resize->is_resize = FALSE;
   mv_resize->moveresize_button = button;
-  mv_resize->moveresize_x = root_x;
-  mv_resize->moveresize_y = root_y;
+  mv_resize->moveresize_x = x + impl->wrapper->x;
+  mv_resize->moveresize_y = y + impl->wrapper->y;
   mv_resize->moveresize_surface = g_object_ref (surface);
 
   mv_resize->moveresize_orig_width = gdk_surface_get_width (surface);